/**
 * toast 提示
 * 为解决navigate时toast提示不显示的问题
 */
import {
	delay
} from './index'

export default function (config, cb, duration = 1000) {
	if (typeof config === 'string') {
		return uni.showToast({
			title: config,
			success: async () => {
				await delay(duration);
				cb && cb();
			}
		})
	}
	
	uni.showToast({
		...config,
		success: async () => {
			await delay(duration);
			cb && cb();
		}
	})
}
